# -*- coding:utf-8 -*-
# title           :
# description     :
# author          :Python超人/三月三提供
# date            :2024-08-10
# link            :https://gitcode.net/pythoncr/
# python_version  :3.9
# ==============================================================================

头发默认颜色列表 = {
    "女/头发01": ["#f18d46"],
    "女/头发02": ["#804537"],
    "女/头发03": ["#51362a"],
    "女/头发04": ["#59474e"],
    "女/头发05": ["#cc6f56"],
    "女/头发06": ["#805333"],
    "女/头发07": ["#51362a"],
    "女/头发08": ["#f0785a"],
    "女/头发09": ["#59474e"],
    "女/头发10": ["#f0c419"],
    "女/头发11": ["#804537"],
    "女/头发12": ["#7d6599"],
    "女/头发13": ["#805333"],
    "女/头发14": ["#d25627"],
    "女/头发15": ["#f0785a"],
    "女/头发16": ["#805333"],
    "女/头发17": ["#f0785a"],
    "女/头发18": ["#f0c419"],
    "女/头发19": ["#f0c419"],
    "女/头发20": ["#c03a2b"],
    "女/头发21": ["#805333"],
    "女/头发22": ["#804537"],
    "女/头发23": ["#59474e"],
    "女/头发24": ["#805333"],
    "女/头发25": ["#59474e"],
    "女/头发26": ["#d75d72"],
    "女/头发27": ["#cb8252"],
    "女/头发28": ["#804537"],
    "女/头发29": ["#cb8252"],
    "女/头发30": ["#804537"],
    "女/头发31": ["#c03a2b"],
    "女/头发32": ["#804537"],
    "女/头发33": ["#804537"],
    "女/头发34": ["#c03a2b"],
    "女/头发35": ["#f0785a"],
    "女/头发36": ["#cc6f56"],
    "女/头发37": ["#805333"],
    "女/头发38": ["#FF690F"],

    "女/后发03": ["###跳过###", "#432b1f"],
    "女/后发10": ["###跳过###", "#c49a13"],
    "女/后发14": ["###跳过###", "#d25627"],
    "女/后发15": ["###跳过###", "#f0785a"],
    "女/后发27": ["###跳过###", "#cb8252"],
    "女/后发35": ["###跳过###", "#ce5f49"],
    "女/后发38": ["#FF690F"],

    "男/头发01": ["#c03a2b"],
    "男/头发02": ["#59474e"],
    "男/头发03": ["#f0c419"],
    "男/头发04": ["#f18d46"],
    "男/头发05": ["#59474e"],
    "男/头发06": ["#cb8252"],
    "男/头发07": ["#cb8252"],
    "男/头发08": ["#805333"],
    "男/头发09": ["#805333"],
    "男/头发10": ["#c03a2b"],
    "男/头发11": ["#f0c419"],
    "男/头发12": ["#f0c419"],
    "男/头发13": ["#d75d72"],
    "男/头发14": ["#f0c419"],
    "男/头发15": ["#f0785a"],
    "男/头发16": ["#cc6f56"],
    "男/头发17": ["#c03a2b"],
    "男/头发18": ["#F2AC2F"],
    "男/头发19": ["#393C3D"],
    "男/头发20": ["#515151", "#393C3D"],
    "男/头发21": ["#2F3233"],
    "男/头发22": ["#FF690F"],
    "男/头发23": ["#999896"],
    "男/头发24": ["#515151"],
    "男/头发25": ["#56545F"],
    "男/头发26": ["#3B3B3B"],
    "男/头发27": ["#393C3D"],
}

胡须默认颜色列表 = {
    "男/胡须01": ["#68442a"],
    "男/胡须02": ["#2f3233"],
    "男/胡须03": ["#474748"],
    "男/胡须04": ["#393c3d"],
    "男/胡须05": ["#86461b"],
    "男/胡须06": ["#393c3d"],
    "男/胡须07": ["#565656"],
    "男/胡须08": ["#56545f"],
    "男/胡须09": ["#ff690f"],
    "男/胡须10": ["#999896", "#8e8d8d"],
    "男/胡须11": ["#515151", "#464747"],
}

眉毛默认颜色列表 = {
    "女/眉毛01": ["#51362a"],
    "女/眉毛02": ["#472b14"],

    "男/眉毛01": ["#51362a"],
}

肤色默认颜色列表 = {
    "女/面部01": ["#fdd7ad"],
    "女/面部02": ["#fdcc9b"],

    "男/面部01": ["#fdd7ad"],
    "男/面部02": ["#fdcc9b"],

    "耳朵01": ["#fcbc85"],
    "耳朵02": ["#ffdecc"],

    "男/上身01": ["#fdcc9b", "#fcbc85"],
    "男/上身02": ["#E8C59E", "#DDB58E"],
    "男/上身03": ["#DBB491", "#CCA483", "#C69E7F"],
    "男/上身04": ["#DBB491", "#CCA483", "#C69E7F"],
    "男/上身05": ["###跳过###", "#DBB491"],
    "男/上身06": ["#E8C59E", "#DDB58E", "#CCA281"],
    "男/上身07": ["#DBB491", "#CCA483", "#C69E7F"],
    "男/上身08": ["#DBB491", "#CCA483", "#C69E7F"],
    "男/上身09": ["#FFDECC", "#F7C5AA"],
    "男/上身10": ["#FFDECC", "#F7C5AA"],
    "男/上身11": ["#FFDECC", "#F7C5AA"],
    "男/上身12": ["#DBB491", "#CCA483", "#C69E7F"],
    # "男/上身13": ["#E8C59E", "#DDB58E"],
    "男/上身14": ["#FFDECC", "#F7C5AA"],

    "女/上身01": ["#E8C59E", "#DDB58E", "#CCA281"],
    "女/上身02": ["#F0B98B", "#CC9568"],
    "女/上身03": ["#F0DEB4"],
    "女/上身04": ["#E8C59E", "#DDB58E", "#CCA281"],
    "女/上身05": ["#E8C59E", "#DDB58E", "#CCA281"],
    "女/上身06": ["#FFDECC", "#F7C5AA"],
    "女/上身07": ["#FFDECC", "#F7C5AA"],
    "女/上身08": ["#FFDECC", "#F7C5AA"],
    "女/上身09": ["#E6A875", "#B88053"],
    "女/上身10": ["#FFDECC", "#F7C5AA"],
    "女/上身11": ["#FFDECC", "#F7C5AA"],
    "女/上身12": ["#FFD16E", "#F7C5AA"],
}


class 常见肤色:
    黑色 = "#70534a"
    白色 = "#ffdecc"
    棕色 = "#d6a57c"
    黄色 = "#fdd7ad"


class 常见发色:
    # _颜色字典 = {
    #     "黑色": ("black", "#000000"),
    #     "白色": ("white", "#ffffff"),
    #     "棕色": ("darkblue", "#00008b")
    # }
    # 棕色发色：‌如薄荷米棕、‌青棕色、‌茶棕色、‌冷茶棕、‌焦糖棕、‌黑茶色、‌摩卡棕、‌栗子棕、‌暖棕色、‌醇棕色、‌蜂蜜茶棕等。‌
    # 紫色发色：‌暗夜紫、‌黑紫色、‌黑加仑紫、‌梦幻紫、‌紫罗兰、‌树莓紫、‌葡萄紫、‌baby紫、‌香芋紫、‌蓝紫色、‌紫灰色、‌薄藤粉紫等。‌
    # 橘色发色：‌落日橘、‌脏橘色、‌夕阳橙、‌柑橘棕、‌金橘色、‌浅橘色、‌枫叶橘、‌橘粉色、‌南瓜橘、‌橘棕色、‌珊瑚橘、‌芬达橘等。‌
    # 红色发色：‌粉棕色、‌复古红、‌枫叶红、‌梅酒红、‌玫红色、‌酒红色、‌红棕色、‌红醋栗、‌波尔多红、‌西柚红、‌浆果红、‌树莓红等。‌
    # 灰色发色：‌米灰色、‌奶茶灰、‌浅灰色、‌亚麻灰、‌灰蓝色、‌银灰色、‌茶棕灰、‌冷灰色、‌紫灰色、‌黑茶灰、‌铅笔灰、‌烟熏灰等。‌
    # 粉色发色：‌藕粉色、‌橘粉色、‌肉桂粉、‌梅蔓粉、‌淡粉色、‌玫瑰粉、‌西柚粉、‌粉紫色、‌粉棕色、‌芭比粉、‌奶茶粉棕、‌粉灰色等。‌
    # 蓝色发色：‌湖蓝色、‌淡蓝色、‌冰川蓝、‌人鱼篮、‌冰蓝色、‌蓝黑色、‌鸢尾蓝、‌蓝紫色、‌克莱因蓝、‌深海蓝、‌雾霾蓝等。‌
    # 金色发色：‌亚麻金、‌灰金色、‌玫瑰金、‌蜂蜜金棕、‌奶茶鎏金、‌米金色、‌浅亚麻金、‌沙金色等。‌

    黑色 = "#2F3233"
    白色 = "#E0DBD3"
    棕色 = "#963B22"
    红棕色 = "#C03A2B"
    橘色 = "#FF690F"
    黄色 = "#FFE51E"
    蓝色 = "#1B9ED6"
    红色 = "#FF2C17"
    金色 = "#AB872F"
    紫色 = "#7D6599"
    绿色 = "#24AE5F"
    粉色 = "#D75D72"

    @staticmethod
    def 颜色加深(颜色值, 加深程度=0.08):
        from 神笔码靓.神笔库.定义集 import 颜色
        if not str(颜色值).startswith("#"):
            颜色值 = 颜色.转16进制颜色(颜色值)
        # 在这里用 python 代码实现, 将 颜色值 格式为: #D75D72 进行颜色加深
        # 将十六进制颜色值转换为 RGB
        r = int(颜色值[1:3], 16)
        g = int(颜色值[3:5], 16)
        b = int(颜色值[5:7], 16)

        # 根据加深程度调整颜色
        r = max(0, int(r * (1 - 加深程度)))
        g = max(0, int(g * (1 - 加深程度)))
        b = max(0, int(b * (1 - 加深程度)))

        # 将 RGB 值转换回十六进制格式
        return f'#{r:02X}{g:02X}{b:02X}'

    @staticmethod
    def 颜色字典():
        if hasattr(常见发色, "filtered_attributes"):
            return getattr(常见发色, "filtered_attributes")
        # 获取类的所有属性
        attributes = vars(常见发色)
        # 或者使用
        # attributes = 系统字体.__dict__

        # 过滤掉特殊属性（如 __module__, __qualname__ 等）
        filtered_attributes = {key: value for key, value in attributes.items()
                               if not key.startswith('__') and not callable(getattr(常见发色, key))}
        # print(filtered_attributes)
        setattr(常见发色, "filtered_attributes", filtered_attributes)
        return filtered_attributes

    @staticmethod
    def 获取发色名(颜色值: str):
        if not hasattr(常见发色, "_发色名字典"):
            发色名字典 = {}
            颜色字典 = 常见发色.颜色字典()
            for key in 颜色字典:
                发色名字典[str(颜色字典[key]).lower()] = key
            setattr(常见发色, "_发色名字典", 发色名字典)
        else:
            发色名字典 = getattr(常见发色, "_发色名字典")

        if 颜色值.lower() in 发色名字典.keys():
            return 发色名字典[颜色值.lower()]

        return 颜色值

# print(常见发色.颜色集合())
